import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
    {
    title: '项目号',
    align:"center",
    dataIndex: 'no'
   },
   {
    title: '项目名',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '所属省份',
    align:"center",
    dataIndex: 'province'
   },
   {
    title: '所属站段',
    align:"center",
    dataIndex: 'station'
   },
   {
    title: '所属地市',
    align:"center",
    dataIndex: 'city'
   },
   {
    title: '地址',
    align:"center",
    dataIndex: 'location'
   },
   {
    title: '建设单位',
    align:"center",
    dataIndex: 'buildCompany'
   },
   {
    title: '建成时间',
    align:"center",
    dataIndex: 'buildFinishTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '房屋报建性质',
    align:"center",
    dataIndex: 'type_dictText'
   },
   {
    title: '建筑结构',
    align:"center",
    dataIndex: 'structure'
   },
   {
    title: '楼层数量',
    align:"center",
    dataIndex: 'floorNum'
   },
   {
    title: '梯口数量',
    align:"center",
    dataIndex: 'elevatorNum'
   },
   {
    title: '住房总套数',
    align:"center",
    dataIndex: 'roomNum'
   },
   {
    title: '确权办证时间',
    align:"center",
    dataIndex: 'confirmTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '备用字段2',
    align:"center",
    dataIndex: 'temp2'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '项目号',
    field: 'no',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入项目号!'},
          ];
     },
  },
  {
    label: '项目名',
    field: 'name',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入项目名!'},
          ];
     },
  },
  {
    label: '所属省份',
    field: 'province',
    component: 'Input',
  },
  {
    label: '所属站段',
    field: 'station',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入所属站段!'},
          ];
     },
  },
  {
    label: '所属地市',
    field: 'city',
    component: 'Input',
  },
  {
    label: '地址',
    field: 'location',
    component: 'Input',
  },
  {
    label: '建设单位',
    field: 'buildCompany',
    component: 'Input',
  },
  {
    label: '建成时间',
    field: 'buildFinishTime',
    component: 'DatePicker',
  },
  {
    label: '房屋报建性质',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"znzf_project_type,name,value"
     }
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入房屋报建性质!'},
          ];
     },
  },
  {
    label: '建筑结构',
    field: 'structure',
    component: 'Input',
  },
  {
    label: '楼层数量',
    field: 'floorNum',
    component: 'InputNumber',
  },
  {
    label: '梯口数量',
    field: 'elevatorNum',
    component: 'InputNumber',
  },
  {
    label: '住房总套数',
    field: 'roomNum',
    component: 'InputNumber',
  },
  {
    label: '确权办证时间',
    field: 'confirmTime',
    component: 'DatePicker',
  },
  {
    label: '备用字段2',
    field: 'temp2',
    component: 'Input',
  },
];

//子表列表数据
export const znzfRoomColumns: BasicColumn[] = [
   {
    title: '房源号',
    align:"center",
    dataIndex: 'no'
   },
   {
    title: '产权证号',
    align:"center",
    dataIndex: 'propertyNo'
   },
   {
    title: '门牌号',
    align:"center",
    dataIndex: 'houseNo'
   },
   {
    title: '宿舍名称（按栋填报）',
    align:"center",
    dataIndex: 'name'
   },
   {
    title: '班组名称',
    align:"center",
    dataIndex: 'groupName'
   },
   {
    title: '单元',
    align:"center",
    dataIndex: 'unit'
   },
   {
    title: '楼层',
    align:"center",
    dataIndex: 'floor'
   },
   {
    title: '房间号',
    align:"center",
    dataIndex: 'roomNo'
   },
   {
    title: '宿舍类型',
    align:"center",
    dataIndex: 'type_dictText'
   },
   {
    title: '面积',
    align:"center",
    dataIndex: 'area'
   },
   {
    title: '建造年月',
    align:"center",
    dataIndex: 'buildTime',
    customRender:({text}) =>{
      return !text?"":(text.length>10?text.substr(0,10):text)
    },
   },
   {
    title: '收费标准',
    align:"center",
    dataIndex: 'fare'
   },
   {
    title: '是否有人住（0无居住，1有居住）',
    align:"center",
    dataIndex: 'islive_dictText'
   },
   {
    title: '图片',
    align:"center",
    dataIndex: 'pic',
    customRender:render.renderAvatar,
   },
   {
    title: '床位数',
    align:"center",
    dataIndex: 'bedNum'
   },
   {
    title: '入住人数',
    align:"center",
    dataIndex: 'livedNum'
   },
   {
    title: '状态（正常，维修中，黑名单,被框定,被锁定）',
    align:"center",
    dataIndex: 'state_dictText'
   },
   {
    title: '备用字段1',
    align:"center",
    dataIndex: 'temp1'
   },
   {
    title: '备用字段2',
    align:"center",
    dataIndex: 'temp2'
   },
];
//子表表单数据
export const znzfRoomFormSchema: FormSchema[] = [
  {
    label: '房源号',
    field: 'no',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入房源号!'},
          ];
     },
  },
  {
    label: '产权证号',
    field: 'propertyNo',
    component: 'Input',
  },
  {
    label: '门牌号',
    field: 'houseNo',
    component: 'Input',
  },
  {
    label: '宿舍名称（按栋填报）',
    field: 'name',
    component: 'Input',
  },
  {
    label: '班组名称',
    field: 'groupName',
    component: 'Input',
  },
  {
    label: '单元',
    field: 'unit',
    component: 'Input',
  },
  {
    label: '楼层',
    field: 'floor',
    component: 'InputNumber',
  },
  {
    label: '房间号',
    field: 'roomNo',
    component: 'Input',
  },
  {
    label: '宿舍类型',
    field: 'type',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"room_type"
     }
  },
  {
    label: '面积',
    field: 'area',
    component: 'InputNumber',
  },
  {
    label: '建造年月',
    field: 'buildTime',
    component: 'DatePicker',
  },
  {
    label: '收费标准',
    field: 'fare',
    component: 'InputNumber',
  },
  {
    label: '是否有人住（0无居住，1有居住）',
    field: 'islive',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"yn"
     }
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入是否有人住（0无居住，1有居住）!'},
          ];
     },
  },
  {
    label: '图片',
    field: 'pic',
     component: 'JImageUpload',
     componentProps:{
      }
  },
  {
    label: '床位数',
    field: 'bedNum',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入床位数!'},
          ];
     },
  },
  {
    label: '入住人数',
    field: 'livedNum',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入入住人数!'},
          ];
     },
  },
  {
    label: '状态（正常，维修中，黑名单,被框定,被锁定）',
    field: 'state',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"room_state"
     }
    dynamicRules: ({model,schema}) => {
          return [
                 { required: true, message: '请输入状态（正常，维修中，黑名单,被框定,被锁定）!'},
          ];
     },
  },
  {
    label: '备用字段1',
    field: 'temp1',
    component: 'Input',
  },
  {
    label: '备用字段2',
    field: 'temp2',
    component: 'Input',
  },
];
